package com.prs.crm.dao.online.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.online.LeadEmailSeeDao;
import com.prs.crm.domain.online.LeadEmailSee;

public class LeadEmailSeeDaoImpl extends BaseDaoImpl<LeadEmailSee> implements LeadEmailSeeDao{

	@SuppressWarnings("unchecked")
	@Override
	public LeadEmailSee getLeadEmailSee(final String type) {
		Criteria criteria=this.getSession().createCriteria(LeadEmailSee.class);
		criteria.add(Restrictions.eq("type", type));
		List result=criteria.list();
		if (result==null || result.size()==0) {
			return null;
		}
		return (LeadEmailSee) criteria.list().get(0);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<LeadEmailSee> getLeadEmailSees(Integer id) {
		Criteria criteria=this.getSession().createCriteria(LeadEmailSee.class);
		criteria.add(Restrictions.eq("id", id));
		return criteria.list();
	}
}
